<?php

App::uses('Crud', 'Model');
App::uses('Workstation', 'Model');
App::uses('UserArea', 'Model');

class LogSchedule extends Crud
{

    public function addCreateLog($userId, $record) {
        $record['log_user_id'] = $userId;
        $record['log_type'] = 1;
        $record['record_id'] = $record['id'];
        unset($record['id']);
        return $this->save($record);
    }

    public function addUpdateLog($userId, $record, $comment = "") {
        $record['log_user_id'] = $userId;
        $record['log_type'] = 2;
        $record['log_comment'] = $comment;
        $record['record_id'] = $record['id'];
        unset($record['id']);
        return $this->save($record);
    }

    public function addDestroyLog($userId, $record, $comment = '') {
        $record['log_user_id'] = $userId;
        $record['log_type'] = 3;
        $record['log_comment'] = $comment;
        $record['record_id'] = $record['id'];
        unset($record['id']);
        return $this->save($record);
    }

    public function addCloseLog($userId, $record, $comment = '') {
        $record['log_user_id'] = $userId;
        $record['log_type'] = 4;
        $record['log_comment'] = $comment;
        $record['record_id'] = $record['id'];
        unset($record['id']);
        return $this->save($record);
    }
}
